<template>
  <el-menu :router="true" :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
    <template v-for="(item,index) in navMenuList">
      <el-menu-item v-if="item.list == null" :index="item.router">{{item.name}}</el-menu-item>
      <sub-item v-else v-bind:menu="item"/>
    </template>
  </el-menu>
</template>

<script>

import SubItem from './SubItem'
export default {
  name: 'MyHeader',
  components:{SubItem},
  data () {
    return {
      activeIndex: '1',
      navMenuList:[],
    }
  },
  mounted(){

  },
  created(){
    this.getNavMenuList();
  },
  methods: {
    handleSelect(){},
    getNavMenuList(){
      this.$api.navMenu.navMenuList().then(res => {
        this.navMenuList = res.list;
      })
    }
  }
}
</script>

<style scoped>

</style>
